﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Led: Led.cs Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                C# examples using state machines generated by StateBuilderDotNet
            </h1>
            <h3>
                Led: Led.cs Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">Led.cs</div>  </div>
</div>
<div class="contents">
<a href="_led_8cs.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ﻿
<a name="l00002"></a><a class="code" href="namespace_state_forge_1_1_examples_1_1_led.html">00002</a> <span class="keyword">namespace </span>StateForge.Examples.<a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html">Led</a>
<a name="l00003"></a>00003 {
<a name="l00004"></a>00004     <span class="keyword">using</span> System;
<a name="l00005"></a>00005     <span class="keyword">using</span> StateForge.StateMachine;
<a name="l00006"></a>00006 
<a name="l00007"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html">00007</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html">Led</a>
<a name="l00008"></a>00008     {
<a name="l00009"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#a1352001c0a1c099c9ae6d35342cf1178">00009</a>         <span class="keyword">private</span> LedContext <a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#a1352001c0a1c099c9ae6d35342cf1178">context</a>;
<a name="l00010"></a>00010 
<a name="l00011"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#a926b3be7979cb98dfb5115f0d4deb003">00011</a>         <span class="keyword">public</span> <a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html">Led</a>()
<a name="l00012"></a>00012         {
<a name="l00013"></a>00013             this.context = <span class="keyword">new</span> LedContext(<span class="keyword">this</span>);
<a name="l00014"></a>00014             this.context.Observer = ObserverConsole.Instance;
<a name="l00015"></a>00015             this.context.EnterInitialState();
<a name="l00016"></a>00016         }
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="preprocessor">        #region Public Methods</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>        <span class="comment">// On</span>
<a name="l00020"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#aad3fca38e4cbbc8859b8107a6eb3d590">00020</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> On()
<a name="l00021"></a>00021         {
<a name="l00022"></a>00022             context.On();
<a name="l00023"></a>00023         }
<a name="l00024"></a>00024 
<a name="l00025"></a>00025         <span class="comment">// Off</span>
<a name="l00026"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#a812f688eea43666bd17ffa3947c34094">00026</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> Off()
<a name="l00027"></a>00027         {
<a name="l00028"></a>00028             context.Off();
<a name="l00029"></a>00029         }
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">        #endregion</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span>
<a name="l00033"></a>00033 <span class="preprocessor">        #region Methods invoked by the context class</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span>        <span class="comment">// DoOn</span>
<a name="l00035"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#a977d28ee2898670215cfa14313867390">00035</a>         <span class="keyword">protected</span> <span class="keyword">internal</span> <span class="keywordtype">void</span> DoOn()
<a name="l00036"></a>00036         {
<a name="l00037"></a>00037             Console.WriteLine(<span class="stringliteral">&quot;DoOn&quot;</span>);
<a name="l00038"></a>00038         }
<a name="l00039"></a>00039 
<a name="l00040"></a>00040         <span class="comment">// DoOff</span>
<a name="l00041"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#a31aa039024c2a44fed7ee377dd787514">00041</a>         <span class="keyword">protected</span> <span class="keyword">internal</span> <span class="keywordtype">void</span> DoOff()
<a name="l00042"></a>00042         {
<a name="l00043"></a>00043             Console.WriteLine(<span class="stringliteral">&quot;DoOff&quot;</span>);
<a name="l00044"></a>00044         }
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="preprocessor">        #endregion</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span>    }
<a name="l00048"></a>00048 
<a name="l00049"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led_app.html">00049</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led_app.html">LedApp</a>
<a name="l00050"></a>00050     {
<a name="l00051"></a><a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led_app.html#aa33356998df5c84d85a5970cb6368db1">00051</a>         <span class="keyword">static</span> <span class="keywordtype">void</span> Main(<span class="keywordtype">string</span>[] args)
<a name="l00052"></a>00052         {
<a name="l00053"></a>00053             <a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html">Led</a> led = <span class="keyword">new</span> <a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html">Led</a>();
<a name="l00054"></a>00054             led.<a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#aad3fca38e4cbbc8859b8107a6eb3d590">On</a>();
<a name="l00055"></a>00055             led.<a class="code" href="class_state_forge_1_1_examples_1_1_led_1_1_led.html#a812f688eea43666bd17ffa3947c34094">Off</a>();
<a name="l00056"></a>00056             
<a name="l00057"></a>00057             Environment.Exit(0);
<a name="l00058"></a>00058         }
<a name="l00059"></a>00059     }
<a name="l00060"></a>00060 }
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
